<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<!--页面头部-->
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0" th:fragment="head">
    <div class="fly-header layui-bg-cyan">
        <div class="layui-container">
            <a class="fly-logo" th:href="@{/index.html}">
                <img th:src="@{/images/logo.png}" style="height: 50px;width: 160px;" alt="layui">
            </a>
            <ul class=" layui-nav  fly-nav layui-hide-xs">
                <li class="layui-nav-item layui-this">
                    <a href="#"><i class="iconfont icon-jiaoliu"></i>广场</a>
                </li>
                <li class="layui-nav-item">
                    <a href="#" id="office"><i class="layui-icon layui-icon-read"></i>办公室</a>
                </li>
                <li class="layui-nav-item">
                    <a href="#" id="box"><i class="layui-icon layui-icon-email"></i>意见箱</a>
                </li>
            </ul>
            <!--           session中有loginUser则证明有用户-->
            <ul class="layui-nav  fly-nav-user" th:if="${session.loginUser==null}">
                <!--                未登入的状态 -->
                <li class="layui-nav-item">
                    <a class="iconfont icon-touxiang layui-hide-xs" th:href="@{/user/login}"></a>
                </li>
                <li class="layui-nav-item">
                    <a th:href="@{/user/login}">登入</a>
                </li>
                <li class="layui-nav-item">
                    <a th:href="@{/user/reg}">注册</a>
                </li>
                <li class="layui-nav-item layui-hide-xs">
                    <!--                    <a href="" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" title="QQ登入"
                                           class="iconfont icon-qq"></a>-->
                    <a href="#" onclick="layer.msg('小的，还在和腾讯协商授权呢', {icon:5, time:3000})" title="QQ登入"
                       class="iconfont icon-qq"></a>
                </li>
                <li class="layui-nav-item layui-hide-xs">
                    <a href="#" onclick="layer.msg('小的，还在和新浪协商授权呢', {icon:5, time:3000})" title="微博登入"
                       class="iconfont icon-weibo"></a>
                </li>
            </ul>
            <ul class="layui-nav  fly-nav-user" th:if="${session.loginUser!=null}">
                <!-- 登入后的状态-->
                <li class="layui-nav-item" th:if="${session.newMessageTotal != null}" th:value="${session.newMessageTotal}">
                    <a href="/user/message"  style="padding:-5px 10px 0px 10px">新消息<span class="layui-badge-dot"></span>&nbsp;&nbsp;&nbsp;</a>
                </li>
                <li class="layui-nav-item">
                <a class="fly-nav-avatar" href="javascript:;" id="LAY_header_avatar">
                    <cite  id="sNickname" class="layui-hide-xs" th:text="${session.loginUser.getNickName()}">NickName</cite>
                    <i class="iconfont icon-renzheng layui-hide-xs" th:if="${session.loginUser.getAuthority() == 3}"
                       title="认证信息：程序员小哥哥"></i>
                    <i class="iconfont icon-renzheng layui-hide-xs" th:if="${session.loginUser.getAuthority() == 2}"
                       title="认证信息：管理员大大"></i>
                    <i class="iconfont icon-renzheng layui-hide-xs" th:if="${session.loginUser.getAuthority() == 1}"
                       th:title="${session.loginUser.getSex()==1} ? '认证信息：社区靓仔' : '认证信息：社区靓妹'"></i>
                    <i class="layui-badge fly-badge-vip layui-hide-xs" id="uRank" >VIP</i>
                    <img id="userAvatar" th:src="${session.loginUser.getAvatar()}" alt="头像">
                </a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{'/user/set/'+${session.loginUser.getUid()}}"><i
                            class="layui-icon layui-icon-set-sm" style="margin-left: 2px; font-size: 24px;"></i>基本设置</a></dd>
                    <dd><a th:href="@{/user/index}"><i class="layui-icon layui-icon-list"></i>我的帖子</a></dd>
                    <dd><a th:href="@{/user/message}"><i class="iconfont icon-tongzhi" ></i>我的消息</a></dd>
                    <dd><a th:href="@{/user/relation}"><i class="layui-icon layui-icon-user " style="top: 4px; font-size: 24px"></i>我的圈子</a></dd>
                    <hr style="margin: 5px 0;">
                    <dd><a th:href="@{/user/logout}" style="text-align: center;">退出</a></dd>
                </dl>
                </li>
                <!--用户uid用于javascript-->
                <input type="hidden" th:value="${session.loginUser.getUid()}" id="uid">
                <input type="hidden" id="nickName" th:value="${session.loginUser.getNickName()}">
                <input type="hidden" th:value="${session.loginUser.getExp()}" id="exp">
                <input type="hidden" th:value="${session.loginUser.getAuthority()}" id="authority">
            </ul>
        </div>
    </div>
</nav>


